#ifndef MCUUPDATEWORKER_H
#define MCUUPDATEWORKER_H
#include <QDebug>
#include <QObject>
#include <QFile>
#include <QTimer>

struct McuIap {
    QByteArray  binData;
    uint8_t     binBuffer[40960]; //40KB
    uint32_t    size;
    uint8_t     crc;
    uint8_t     count;
};

class McuUpdateWorker : public QObject
{
    Q_OBJECT
public:
    static McuUpdateWorker* getInstance();
    int loadMcuBinFile(QString path);

private:
    McuUpdateWorker();
    McuIap g_mcuIap;
    QTimer* g_timer;

signals:
    void syncInfoSignal(QString info);
    void mcuUpdateCompleteSignal();

public slots:
    void startEnterMcuUpdateSlot(QString path);
    void mcuUpdateRequestSlot();

private slots:
    void timeoutSlot();
};

#endif // MCUUPDATEWORKER_H
